package tests;

import static org.junit.Assert.*;

import java.util.LinkedList;

import org.junit.Test;

import category.Category;

import recipie.core.Ingredient;
import recipie.core.MesureUnit;
import recipie.core.IngredientCollection;;

public class IngredientTest {
	
	@Test
	public void TestcreateIngredient(){
		Ingredient i = new Ingredient("Prosciutto", MesureUnit.kg);
		assertNotNull(i);
	}
	
	@Test
	public void TestaddIngredient(){
		Ingredient i = new Ingredient("Prosciutto", MesureUnit.kg);
		IngredientCollection aI = new IngredientCollection();
		aI.addIngredient(i);
		assertTrue(aI.containsIngredient(i));
	}
	
	@Test
    public void TestsetUnit(){
        Ingredient i = new Ingredient("Sale", MesureUnit.kg);
        i.setUnit(MesureUnit.pizz);
        assertTrue(i.getUnit().equals(MesureUnit.pizz));
    }
	
	@Test
    public void TestaddCategory(){
        Category c = new Category();
        c.setName("Latticini");
        Ingredient i = new Ingredient("latte", MesureUnit.l);
        i.setCategory(c);
        assertTrue(i.getCategories().contains(c));
    }
	
	@Test
    public void TestaddCategories(){
        Category c = new Category();
        LinkedList<Category> lc = new LinkedList<Category>();
        lc.add(c);
        Ingredient i = new Ingredient("Sale", MesureUnit.kg);
        i.setCategories(lc);
        assertTrue(i.getCategories().contains(c));
    }
}
